<template>
  <div class="app-container">
    <!--展示结果-->
    <el-dialog v-bind="$attrs" title="返回结果" width="60%">
      <json-viewer :value="jsonData" copyable theme="my-awesome-json-theme"></json-viewer>
      <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="close">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import JsonViewer from 'vue-json-viewer'

export default {
  name: 'JsonShow',
  // 注册组件
  components: {
    JsonViewer
  },
  // 父组件传递的参数
  props: {
    jsonData: {
      type: Object
    }
  },
  data() {
    return {}
  },
  created() {
  },
  methods: {
    // 取消按钮
    close() {
      this.$emit('update:visible', false)
    }
  }
}
</script>


<style lang="scss" scoped>
.my-awesome-json-theme {
  overflow-x: hidden;
  background: #e9e9eb;
  white-space: nowrap;
  color: red;
  font-size: 14px;
  font-family: Consolas, Menlo, Courier, monospace;

  .jv-button {
    color: #49b3ff;
  }

  ::v-deep .jv-key {
    color: red !important;
  }

  ::v-deep .jv-push {
    color: black;
  }
}
</style>

